package reflect.demo;

/**
 * 使用当前类测试反射
 */
public class Person {
    private String name = "张三";
    private int age = 18;

    public Person(){}

    public Person(String name){
        this.name = name;
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void sayHello(){
        System.out.println(name+":hello");
    }
    public void sayHi(){
        System.out.println(name+":hi");
    }
    public void sayGoodBye(){
        System.out.println(name+":goodBye");
    }
    public void playGame(){
        System.out.println(name+":打游戏");
    }
    public void watchTV(){
        System.out.println(name+":看电视");
    }

    public void say(String info){
        System.out.println(name+"说:"+info);
    }

    public void say(String info,int count){
        for(;count>0;count--) {
            System.out.println(name + "说:" + info);
        }
    }

    private void heihei(){
        System.out.println("我是Person的私有方法，嘿嘿嘿~");
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
